
from OpenGL.GLUT import glutSolidSphere
from amt.cg.core.object3d import Object3D
from amt.cg.core.arcball import Arcball
import numpy

class Sphere(Object3D):
    '''
    Simple Sphere.
    '''

    SLICE_NUMBER = 30
    STACK_NUMBER = 30
    
    def __init__(self, radius, center_position=None, camera=None,
                 rotation_matrix=None, color=None,
                 pickable=True):
        '''
        Calls the Object3D's constructor and sets the sphere's radius.
        '''
        Object3D.__init__(self, center_position, camera, 
                          rotation_matrix, color, pickable)
        self.radius = radius
        self.arcball_radius = radius
        self.arcball = Arcball("object", self.center_position, 
                               self.arcball_radius, self.camera)
        
    def _draw_geometry(self):
        '''
        Draws the 3D object's vertices.
        '''
        glutSolidSphere(self.radius, Sphere.SLICE_NUMBER, Sphere.STACK_NUMBER)
